<?php

class ClassHelper {

    public static function convertClass($controller_name) {
        $len = strlen($controller_name);
        $result = '';
        for ($i = 0; $i < $len; $i++) {
            while ($i < $len && ($controller_name[$i] == '-' || $controller_name[$i] == ' ')) {
                $i++;
            }

            if ($i < $len) {
                $result.= strtoupper($controller_name[$i]);
                $i++;
                while ($i < $len && $controller_name[$i] != "-" && $controller_name[$i] != ' ') {
                    $result.= $controller_name[$i];
                    $i++;
                }
                $i--;
            }
        }
        return $result;
    }

    public static function convertMethod($controller_name) {
        $len = strlen($controller_name);
        $result = '';
        for ($i = 0; $i < $len; $i++) {
            while ($i < $len && ($controller_name[$i] == '-' || $controller_name[$i] == ' ')) {
                $i++;
            }

            if ($i < $len) {
                if ($result == '') {
                    $result.= $controller_name[$i];
                } else {
                    $result.= strtoupper($controller_name[$i]);
                }
                $i++;
                while ($i < $len && $controller_name[$i] != "-" && $controller_name[$i] != ' ') {
                    $result.= $controller_name[$i];
                    $i++;
                }
                $i--;
            }
        }
        return $result;
    }

}